package com.xingda.packing.dmds.minitor.controller;


import com.xingda.packing.dmds.common.BaseController;
import com.xingda.packing.dmds.common.R;
import com.xingda.packing.dmds.minitor.dto.PkClassWheelCountDto;
import com.xingda.packing.dmds.minitor.dto.WheelCountByRobotDto;
import com.xingda.packing.dmds.minitor.service.IPkTaskInfoService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 前端控制器
 */
@RestController("pkTaskInfoDMDSController")
@RequestMapping("/api/taskInfo")
public class PkTaskInfoController extends BaseController {

    @Resource
    IPkTaskInfoService pkTaskInfoService;

    @GetMapping("/getClassWheelCount")
    public R getClassWheelCount(@RequestParam() String start, @RequestParam() String end) {

        try {
            PkClassWheelCountDto dto = pkTaskInfoService.getClassWheelCount(start, end);
            return R.ok().put("data", dto);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.error();
    }

    @GetMapping("getClassWheelCountByRobot")
    public R getClassWheelCountByRobot(@RequestParam() String start, @RequestParam() String end) {

        try {
            List<WheelCountByRobotDto> countList = pkTaskInfoService.getClassWheelCountByRobot(start, end);
            return R.ok().put("data", countList);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return R.error();
    }
}

